From d825ae4054738f5a622f38e16695b501fc5b2088 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Mon, 15 Aug 2005 19:02:34 +0000 Subject: [PATCH] added stubs for ycbcr and cmyk color models --- ChangeLog | 5 ++ babl/base/model-cmyk.c | 175 ++++++++++++++++++++++++++++++++++++++++ babl/base/model-ycbcr.c | 108 +++++++++++++++++++++++++ 3 files changed, 288 insertions(+) create mode 100644 babl/base/model-cmyk.c create mode 100644 babl/base/model-ycbcr.c diff --git a/ChangeLog b/ChangeLog index b74868b..0e461a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-08-15 Øyvind Kolås + + * babl/base/model-cmyk.c + * babl/base/model-ycbcr.c: added stubs + 2005-08-15 Øyvind Kolås * configure.ac: add rule to generate babl/base/Makefile diff --git a/babl/base/model-cmyk.c b/babl/base/model-cmyk.c new file mode 100644 index 0000000..d74f3fc --- /dev/null +++ b/babl/base/model-cmyk.c @@ -0,0 +1,175 @@ +/* babl - dynamically extendable universal pixel conversion library. + * Copyright (C) 2005, Øyvind Kolås. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include "babl.h" + +#include "util.h" + +static void components (void); +static void models (void); +static void conversions (void); +static void pixel_formats (void); + +void +babl_base_model_cmyk (void) +{ + components (); + models (); + conversions (); + pixel_formats (); +} + +static void +components (void) +{ + babl_component_new ( + "cyan", + "id", BABL_CYAN, + NULL); + + babl_component_new ( + "yellow", + "id", BABL_YELLOW, + NULL); + + babl_component_new ( + "magenta", + "id", BABL_MAGENTA, + NULL); + + babl_component_new ( + "key", + "id", BABL_KEY, + NULL); +} + +static void +models (void) +{ + babl_model_new ( + "cmy", + "id", BABL_CMY, + babl_component_id (BABL_CYAN), + babl_component_id (BABL_MAGENTA), + babl_component_id (BABL_YELLOW), + NULL + ); + babl_model_new ( + "cmyk", + "id", BABL_CMYK, + babl_component_id (BABL_CYAN), + babl_component_id (BABL_MAGENTA), + babl_component_id (BABL_YELLOW), + babl_component_id (BABL_KEY), + NULL + ); + + babl_model_new ( + "cmyka", + "id", BABL_CMYKA, + babl_component_id (BABL_CYAN), + babl_component_id (BABL_MAGENTA), + babl_component_id (BABL_YELLOW), + babl_component_id (BABL_KEY), + babl_component_id (BABL_ALPHA), + NULL + ); +} + +static void +rgb_to_and_from_cmy (int src_bands, + void **src, + int *src_pitch, + int dst_bands, + void **dst, + int *dst_pitch, + int n) +{ + BABL_PLANAR_SANITY + + while (n--) + { + int band; + for (band=0; band< 3; band++) + { + *(double*)dst[band] = 1.0F- (*(double*) src[band]); + } + for (;band +#include +#include +#include "babl.h" + +#include "util.h" + +static void components (void); +static void models (void); +static void conversions (void); +static void pixel_formats (void); + +void +babl_base_model_ycbcr (void) +{ + components (); + models (); + conversions (); + pixel_formats (); +} + +static void +components (void) +{ + babl_component_new ( + "Cb", + "id", BABL_CB, + "chroma", + NULL); + + babl_component_new ( + "Cr", + "id", BABL_CR, + "chroma", + NULL); +} + +static void +models (void) +{ +} + +static void +conversions (void) +{ +} + +static void +pixel_formats (void) +{ + babl_pixel_format_new ( + "yuv420", + "id", BABL_YUV420, + "planar", + babl_model_id (BABL_YCBCR), + babl_type_id (BABL_U8), + babl_sampling (1, 1), babl_component_id (BABL_LUMINANCE), + babl_sampling (2, 2), babl_component_id (BABL_CB), + babl_sampling (2, 2), babl_component_id (BABL_CR), + NULL); + +#if 0 + babl_pixel_format_new ( + "yuv411", + "id", BABL_YUV411, + "planar", + babl_type ("u8"), + babl_sampling (1, 1), + babl_component ("Y"), + babl_sampling (4, 1), + babl_component_id (BABL_CB), + babl_sampling (4, 1), + babl_component_id (BABL_CR), + NULL); + + babl_pixel_format_new ( + "yuv422", + "id", BABL_YUV422, + "planar", + babl_type ("u8"), + babl_sampling (1, 1), + babl_component ("Y"), + babl_sampling (2, 1), + babl_component_id (BABL_CB), + babl_sampling (2, 1), + babl_component_id (BABL_CR), + NULL); +#endif +} -- 2.30.2